 ///
 /// @file    static_cast.cc
 /// @author  lemon(haohb13@gmail.com)
 /// @date    2016-02-24 23:14:12
 ///
 
#include <iostream>

using std::cout;
using std::endl;


int func(int * pa) // int * pa = &b;
{
	return *pa;
}


int main(void)
{
	int a = 3;
	//double d1 = (double)a;//C
	double d1 = double(a);
	double d2 = static_cast<double>(a);//C++的强制转换类型关键字
	//const_cast  dynamic_cast   reinterpret_cast

	cout << "d1 = " << d1 << endl;
	cout << "d2 = " << d2 << endl;


	const int b = 10;
	int * pc = const_cast<int *>(&b);
	*pc = 11;
	cout << "*pc = " << *pc << endl;
	cout << "b = " << b << endl;

	func(const_cast<int *>(&b));// 用于函数传参

	return 0;
}
